#ifndef __LFS_PORT_H
#define __LFS_PORT_H

#include "bsp_spi_flash_w25qxx.h"
#include "lfs.h"
#include "lfs_util.h"

#define W25Q128_SECTOR_SIZE 4096 // 1 Sector = 16 Page = 16 *256 = 4096 Byte
#define W25Q128_SECTOR_NUM 4096 // 总大小: 4096 Sector * 4096 Byte = 16MB

int lfs_spi_flash_init(struct lfs_config *cfg);
int lfs_spi_flash_read(const struct lfs_config *cfg, lfs_block_t block, lfs_off_t off, void *buffer, lfs_size_t size);
int lfs_spi_flash_prog(const struct lfs_config *cfg, lfs_block_t block, lfs_off_t off, const void *buffer, lfs_size_t size);
int lfs_spi_flash_erase(const struct lfs_config *cfg, lfs_block_t block);
int lfs_spi_flash_sync(const struct lfs_config *cfg);

void TestLFS1(const struct lfs_config *cfg, lfs_t *lfs, lfs_file_t *file);


#endif // __LFS_PORT_H
